home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 7 / BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso / Files / Hyper / I-J / ICON Buttons.cpt / ICON Buttons / card_6024.txt < prev    next >
Text File  |  1990-12-13  |  10KB  |  325 lines

  1. -- card: 6024 from stack: in
  2. -- bmap block id: 4138
  3. -- flags: 4000
  4. -- background id: 5475
  5. -- name: Computer paper
  6. ----- HyperTalk script -----
  7. on openCard
  8.   checkGarbage
  9. end openCard
  10.  
  11.  
  12. -- part 6 (button)
  13. -- low flags: 00
  14. -- high flags: A003
  15. -- rect: left=197 top=182 right=261 bottom=304
  16. -- title width / last selected line: 0
  17. -- icon id / first selected line: 5422 / 5422
  18. -- text alignment: 1
  19. -- font id: 0
  20. -- text size: 12
  21. -- style flags: 0
  22. -- line height: 16
  23. -- part name: Add ICON Buttons
  24. ----- HyperTalk script -----
  25. --The basic installer script was written by Mark G. Mendel
  26. on mouseUp
  27.   if the name of the target contains "Remove ICON Buttons" then
  28.     deinstall
  29.   else
  30.     install
  31.   end if
  32. end mouseUp
  33.  
  34. --"ICON Buttons SCRIPT" is the actual script that is being installed.
  35.  
  36. on install
  37.   set the cursor to 4
  38.   set lockScreen to true
  39.  
  40.   put the script of stack "Home" into homeScript
  41.   if "ICON Buttons" is in homeScript then
  42.     answer "ICON Button is already installed"
  43.     set the name of the target to "Remove ICON Buttons"
  44.     checkGarbage
  45.     exit install
  46.   end if
  47.  
  48.   put return & "-- BEGIN ICON BUTTONS SCRIPT" after homeScript
  49.  
  50.   -- add the scripts to the home stack
  51.   put card field "Home Addition" after homeScript
  52.  
  53.   put return & "-- END ICON BUTTONS SCRIPT" after homeScript
  54.  
  55.   set the script of stack "home" to homeScript
  56.   set the name of the target to "Remove ICON Buttons"
  57.   set the script of this stack to empty
  58.   answer "Quit HyperCard to add ICON B. to memory."
  59.   answer "Please quit and restart HyperCard." with ICON_In
  60.   checkGarbage
  61. end install
  62.  
  63. on deinstall
  64.   set the cursor to 4
  65.   set lockScreen to true
  66.  
  67.   put the script of stack "Home" into homeScript
  68.   if "ICON Buttons" is not in homeScript then
  69.     answer "ICON Buttons is not installed"
  70.     set the name of the target to "Install ICON Buttons"
  71.     checkGarbage
  72.     exit deinstall
  73.   end if
  74.  
  75.   -- delete between "-- BEGIN ICON BUTTONS SCRIPT" and " -- END ICON BUTTONS SCRIPT"
  76.   put offset(" BEGIN ICON BUTTONS SCRIPT",homeScript)-2 into start
  77.   put offset(" END ICON BUTTONS SCRIPT",homeScript)+length (" END ICON BUTTONS SCRIPT") into finish
  78.   delete char start to finish of homeScript
  79.  
  80.   set the script of stack "home" to homeScript
  81.   set the name of the target to "Add ICON BUTTONS"
  82.   answer "Quit HyperCard to remove ICON B."
  83.   answer "Please quit and restart HyperCard." with ICON_Gone
  84.   checkGarbage
  85. end deinstall
  86.  
  87.  
  88. -- part 3 (button)
  89. -- low flags: 00
  90. -- high flags: 0000
  91. -- rect: left=228 top=14 right=63 bottom=275
  92. -- title width / last selected line: 0
  93. -- icon id / first selected line: 29019 / 29019
  94. -- text alignment: 1
  95. -- font id: 0
  96. -- text size: 12
  97. -- style flags: 0
  98. -- line height: 16
  99. -- part name: up
  100. ----- HyperTalk script -----
  101. on mouseUp
  102.   visual effect scroll down very fast
  103.   go prev
  104. end mouseUp
  105.  
  106.  
  107.  
  108. -- part 9 (button)
  109. -- low flags: 00
  110. -- high flags: A000
  111. -- rect: left=354 top=258 right=306 bottom=428
  112. -- title width / last selected line: 0
  113. -- icon id / first selected line: 21982 / 21982
  114. -- text alignment: 1
  115. -- font id: 0
  116. -- text size: 12
  117. -- style flags: 0
  118. -- line height: 16
  119. -- part name: Compact Stack
  120. ----- HyperTalk script -----
  121. on mouseUp
  122.   if the freesize of this stack >0 then
  123.     put the userLevel into yourLevel --save the current userlevel
  124.     if the userLevel < 4 then set userLevel to 4 -- "Authoring"
  125.     if the userLevel < 4 then exit mouseUp
  126.     domenu "compact stack"
  127.     set visible of field "trashBytes" to false
  128.     set userLevel to yourLevel --reset the userlevel how we found it
  129.   end if
  130. end mouseUp
  131.  
  132.  
  133. -- part 5 (field)
  134. -- low flags: 81
  135. -- high flags: 0007
  136. -- rect: left=45 top=29 right=306 bottom=460
  137. -- title width / last selected line: 0
  138. -- icon id / first selected line: 0 / 0
  139. -- text alignment: 0
  140. -- font id: 3
  141. -- text size: 10
  142. -- style flags: 0
  143. -- line height: 13
  144. -- part name: Home Addition
  145.  
  146.  
  147. -- part 7 (button)
  148. -- low flags: 80
  149. -- high flags: A003
  150. -- rect: left=197 top=313 right=335 bottom=297
  151. -- title width / last selected line: 0
  152. -- icon id / first selected line: 0 / 0
  153. -- text alignment: 1
  154. -- font id: 0
  155. -- text size: 12
  156. -- style flags: 0
  157. -- line height: 16
  158. -- part name: Hide Script
  159. ----- HyperTalk script -----
  160. on mouseUp
  161.   set the scroll of card field "Home Addition" to 0
  162.   set visible of card button "Hide Script" to false
  163.   set visible of card button "Show ICON Buttons Script" to true
  164.   set visible of card field "Home Addition" to false
  165.   checkGarbage
  166. end mouseUp
  167.  
  168.  
  169.  
  170. -- part 8 (button)
  171. -- low flags: 00
  172. -- high flags: A003
  173. -- rect: left=155 top=316 right=336 bottom=336
  174. -- title width / last selected line: 0
  175. -- icon id / first selected line: 0 / 0
  176. -- text alignment: 1
  177. -- font id: 0
  178. -- text size: 12
  179. -- style flags: 0
  180. -- line height: 16
  181. -- part name: Show ICON Buttons Script
  182. ----- HyperTalk script -----
  183. on mouseUp
  184.   set visible of card button "Show ICON Buttons Script" to false
  185.   set visible of card button "Hide Script" to true
  186.   set visible of card field "Home Addition" to true
  187. end mouseUp
  188.  
  189.  
  190.  
  191. -- part contents for card part 5
  192. ----- text -----
  193.  
  194.  
  195. --ICON Buttons script was edited by Mark Spaulding
  196. --The basic design of this Script is from Stack Developer-
  197. --Mini HyperStation by Steve Drazga
  198. --This script needs the following External resources installed in the Home
  199. --Stack:
  200. --GetAppIcon XFCN, GetDocIcon XCFN, & UpdateResFork- by J. Paul and
  201. --FileName XFCN- by Steve Maller
  202.  
  203. on appButton
  204.   --This gets the application to make into a button
  205.   put "Please select Application."
  206.   put filename("APPL") into LongName
  207.   if LongName is empty then exit appButton
  208.   
  209.   --This makes the button
  210.   put the userLevel into yourLevel --save the current userlevel
  211.   if the userLevel < 5 then set userLevel to 5 -- "scripting"
  212.   if the userLevel < 5 then exit appButton
  213.   set the cursor to 4
  214.   set lockscreen to true
  215.   doMenu "New Button"
  216.   set showName of button "New Button" to true
  217.   set style of button "New Button" to transparent
  218.   set rect of button "New Button" to 190,100,275,150
  219.   
  220.   
  221.   --This does the script for the button
  222.   get script of button "New Button"
  223.   put "on mouseUp" into appScript
  224.   put "open"&"e&LongName"e into line 2 of appScript
  225.   put "end mouseUp" into line 3 of appScript
  226.   set script of button "New Button" to appScript
  227.   
  228.   --This sets the ICON of the button with GetapplIcon XFCN
  229.   put long name of this stack into thisStack
  230.   put char 8 to (number of chars in thisStack - 1) of thisStack into thisStack
  231.   put GetAppIcon(LongName,LongName,thisStack) into iconNum
  232.   set icon of button "New Button" to iconNum
  233.   UpdateResFork
  234.   put ConvertButtonName(LongName) into shortName
  235.   set name of button "New Button" to shortName
  236.   set lockScreen to false
  237.   
  238.   -- Place the Button where you want it.
  239.   set cursor to 3
  240.   put "Drag the" &"e&shortName"e&& "button to the desired location"
  241.   wait until the mouse is down
  242.   repeat until the mouse is up
  243.     set loc of button shortName to the mouseLoc
  244.   end repeat
  245.   set userLevel to yourLevel --reset the userlevel how we found it
  246.   choose browse tool
  247.   hide message
  248. end appButton
  249.  
  250.  
  251. on docButton
  252.   --This determines the application which will open the document
  253.   put "Please select the Application that created the document."
  254.   put filename("APPL") into appName
  255.   if appName is empty then exit docButton
  256.   
  257.   --This gets the document to make a button out of
  258.   put "Please select the Document."
  259.   --Unfortunately, this will show all files.  Inorder to see just one type,
  260.   --put the ‚Äúcreator‚Äù of the file between the parentheses, e.g., ("WDBN") for
  261.   --Word 3.0X
  262.   put filename() into longName
  263.   if longName is empty then exit docButton
  264.   
  265.   --This makes the button
  266.   put the userLevel into yourLevel --save the current userlevel
  267.   if the userLevel < 5 then set userLevel to 5 -- "scripting"
  268.   if the userLevel < 5 then exit docButton
  269.   set the cursor to 4
  270.   set lockscreen to true
  271.   doMenu "New Button"
  272.   set showName of button "New Button" to true
  273.   set style of button "New Button" to transparent
  274.   set rect of button "New Button" to 190,100,275,150
  275.   
  276.   --This does the script for the button
  277.   get script of button "New Button"
  278.   put "on mouseUp" into docScript
  279.   put "open"&"e&LongName"e&&"with"¬¨
  280.   &"e&appName"e into line 2 of docScript
  281.   put "end mouseUp" into line 3 of docScript
  282.   set script of button "New Button" to docScript
  283.   
  284.   --This sets the ICON of the button using GetDocIcon XCFN
  285.   put long name of this stack into thisStack
  286.   put char 8 to (number of chars in thisStack - 1) of thisStack into thisStack
  287.   put GetDocIcon(appName,LongName,thisStack) into iconNum
  288.   set icon of button "New Button" to iconNum
  289.   UpdateResFork
  290.   put ConvertButtonName(LongName) into shortName
  291.   set name of button "New Button" to shortName
  292.   set lockScreen to false
  293.   
  294.   -- Place the Button where you want it.
  295.   set cursor to 3
  296.   put "Drag the" &"e&shortName"e&& "button to the desired location"
  297.   wait until the mouse is down
  298.   repeat until the mouse is up
  299.     set loc of button shortName to the mouseLoc
  300.   end repeat
  301.   set userLevel to yourLevel --reset the userlevel how we found it
  302.   choose browse tool
  303.   hide message
  304. end docButton
  305.  
  306. --a needed function for the externalApp & wordDoc handlers
  307. --Also by Steve Drazga and Stack Developer
  308.  
  309. function ConvertButtonName LongName
  310.   put the length of LongName into nameLength
  311.   repeat with x = nameLength down to 1
  312.     if char x of LongName = ":" then exit repeat
  313.   end repeat
  314.   return char (x + 1) to nameLength of LongName
  315. end ConvertButtonName
  316.  
  317.  
  318. -- part contents for background part 10
  319. ----- text -----
  320. For Better Efficiency
  321. Compact Stack
  322. FreeSize = 
  323. 13 K
  324. Available Memory =
  325. 373 K